package com.jackeys.piaems.controller;

import com.jackeys.piaems.service.ImageService;
import com.jackeys.piaems.vo.ResponseVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName: ImageController
 * @Description: 入侵检测控制器
 * @Author: Jackeys
 * @Date: 2021-06-28 16:50
 * @Version: 1.0
 */
@CrossOrigin
@RestController
public class ImageController {
    
    @Autowired
    private ImageService imageService;
    
    /**
    * @Name: getImageBySize
    * @Description: 处理用户查询入侵检测请求
    * @Param: [page]
    * @return: com.jackeys.piaems.vo.ResponseVo
    * @Author: Jackeys
    * @Date: 2021/6/28 16:57
    * @Version: 1.0
    */
    @RequestMapping("/image/getImageBySize")
    public ResponseVo getImageBySize(Integer page){
        return imageService.queryImageBySize(page);
    }
    
    
    /**
    * @Name: sendImageAlert
    * @Description: 处理用户发送入侵检测邮件
    * @Param: [email]
    * @return: com.jackeys.piaems.vo.ResponseVo
    * @Author: Jackeys
    * @Date: 2021/6/30 22:04
    * @Version: 1.0
    */
    @RequestMapping("/image/sendImageAlert")
    public ResponseVo sendImageAlert(String email){
        return imageService.sendEmailAlert(email);
    }

    /**
    * @Name: queryConditionImage
    * @Description: 处理用户按照条件分页查询图片
    * @Param: [page, condition]
    * @return: com.jackeys.piaems.vo.ResponseVo
    * @Author: Jackeys
    * @Date: 2021/6/30 22:08
    * @Version: 1.0
    */
    @RequestMapping("/image/queryConditionImage")
    public ResponseVo queryConditionImage(Integer page,String condition){
        return imageService.queryImageBySizeAndCondition(page,condition);
    }

    /**
    * @Name: queryImageCnt
    * @Description: 处理用户按照每日查询入侵图片操作
    * @Param: []
    * @return: com.jackeys.piaems.vo.ResponseVo
    * @Author: Jackeys
    * @Date: 2021/6/30 22:13
    * @Version: 1.0
    */
    @RequestMapping("/image/queryImageCntByDate")
    public ResponseVo queryImageCnt(){
        return imageService.queryImageCntByDate();
    }
}
